<template>
	<view class="constant">
		<view v-if="growupList.length==0" style="color: #CCCCCC;text-align: center;width: 100%;height: 500upx;line-height: 500upx;font-size: 32upx;"> 暂无相关记录</view>
		<view v-else>
			<view class="first" v-for="(item,index) in growupList"  :key="index" v-if="item.COUPON!=0">
				<view class="left">
					<view class="top">{{item.DESCRIBE}}</view>
					<view class="bottom">
						{{item.CREATEDATE}}
					</view>
				</view>
				<view class="right" v-if="item.COUPON>0 && item.TYPE==1 ">
				+{{item.COUPON}}
				</view>
				<view class="right" v-if="item.COUPON>0 && item.TYPE==2 " style="color: #1AAD19;">
				-{{item.COUPON}}
				</view>
				<view class="right" v-else>{{item.COUPON}}</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				growupList:[]
			}
		},
		onLoad() {
			this.loadData()
			uni.startPullDownRefresh();
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			async loadData(){
				this.$http.post("/user/valueLog",{
					SIGNATURE:uni.getStorageSync("SIGNATURE"),
					TOKEN:uni.getStorageSync('userInfo').TOKEN,
				}).then(res=>{
					if(res.data.STATE==='0' && res.statusCode===200){
						if(res.data.STATE==='0' && res.statusCode===200){
							res.data.OBJECT.map(item=>{
								if(item.COUPON!=0){
									this.growupList.push(item);
								}
							})
							
						}
					}
				}).catch(err=>{
					console.log('request fail',err);
				})
			}
		},
		// #ifndef MP
		//点击导航栏 buttons 时触发
	onNavigationBarButtonTap() {
			uni.navigateTo({
				url: '/pages/memberHelp/memberHelp?state=1'
			})
	}
	// #endif
	}
</script>

<style lang="scss">
	
	page{
		background-color: #F5F5F5;
	}
	.constant{
		
	}
	.first{
		position: relative;
		padding: 20upx 40upx;
		border-bottom: 1upx solid #f5f5f5;
		border-top: 1upx solid #f5f5f5;
		display: flex;
		background-color:#FFFFFF;
		.top{
			font-size: 30upx;
		}
		.bottom{
			font-size: 25upx;
		}
		.right{
			position: absolute;
			right: 50upx;
			bottom: 40upx;
			font-size: 30upx;
			color: #E02E24;
		}
	}
	
</style>
